package com.biqee.service.framework.impl;

import org.springframework.transaction.support.TransactionTemplate;

/**
 * 提供编程式事务支持的服务类实现，所有需要编程式事务支持的service实现类可以继承本类
 * 
 * 方法中的事务代码示例
 * A.有结果返回：
 * getTransactionTemplate().execute(new TransactionCallback() {
 *		public Object doInTransaction(TransactionStatus status) {
 *			......
 *			if (要回滚) {
 *				throw new RuntimeException;
 *			}			
 *			return result;
 *		}
 *	});
 *
 * B.无结果返回：
 * getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
 *		public void doInTransactionWithoutResult(TransactionStatus status) {
 *			......
 *			if (要回滚) {
 *				throw new RuntimeException;
 *			}
 *		}
 *	});
 *
 * @author guotao.tangt
 *
 */
public class BaseTransactionSupportServiceImpl {
	private TransactionTemplate transactionTemplate;

	public void setTransactionTemplate(TransactionTemplate transactionTemplate) {
		this.transactionTemplate = transactionTemplate;
	}

	protected TransactionTemplate getTransactionTemplate() {
		return transactionTemplate;
	}
	
}
